package net.fdukedom.epicurus.presentation.actions.user;

import net.fdukedom.epicurus.presentation.actions.AbstractAction;
import net.fdukedom.epicurus.presentation.SessionData;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Logout action. Removes user's session data from session.
 *
 * @author Dmitry Y. Kochelaev
 */
public class LogoutAction extends AbstractAction {

    protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
        SessionData.clearInstance(request);
        return mapping.findForward("success");
    }

}
